package project2.entity.enemy;

import project2.entity.Flyable;
import project2.type.EnemyPlaneType;
import project2.ui.game.GamePlayingPanel;

import java.awt.*;

/**
 * 敌机抽象类
 */
public abstract class EnemyPlane extends Flyable {
    private int hittedCount;// 被命中计数
    private int killedCount;// 被命中计数最大值，大于此值则被消灭
    private int killedScore;// 被消灭后获得的积分
    private EnemyPlaneType enemyType;// 类型

    public EnemyPlane(GamePlayingPanel playingPanel, EnemyPlaneType enemyType) {
        setPlayingPanel(playingPanel);
        this.enemyType = enemyType;
        this.hittedCount = 0;
    }

    // 常用方法

    public void addHittedCount() {
        this.hittedCount++;
    }

    public boolean isKilled() {
        return this.hittedCount >= this.killedCount;
    }

    // 待子类实现方法

    /**
     * 绘制战斗时的样子（抽象方法）
     */
    public abstract void drawFighting(Graphics g);

    /**
     * 绘制被消灭时的样子（抽象方法）
     */
    public abstract void drawKilled(Graphics g);

    // get、set方法

    public EnemyPlaneType getEnemyType() {
        return enemyType;
    }

    public void setEnemyType(EnemyPlaneType enemyType) {
        this.enemyType = enemyType;
    }

    public int getHittedCount() {
        return hittedCount;
    }

    public void setHittedCount(int hittedCount) {
        this.hittedCount = hittedCount;
    }

    public int getKilledCount() {
        return killedCount;
    }

    public void setKilledCount(int killedCount) {
        this.killedCount = killedCount;
    }

    public int getKilledScore() {
        return killedScore;
    }

    public void setKilledScore(int killedScore) {
        this.killedScore = killedScore;
    }

}
